﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Data.SqlClient;



namespace 图书管理系统
{
    public partial class 首页 : Form
    {
        User user = 用户登录.user;
        public 首页()
        {
            InitializeComponent();
            
        }
        public 首页(User user0)
        {
            InitializeComponent();
            
            label13.Text = "欢迎您： "+user.Name;
        }
        System.Timers.Timer t;
        private void Form1_Load(object sender, EventArgs e)
        {
            comboBox1.SelectedIndex = 0;
           /* t = new System.Timers.Timer(10000);
            t.Elapsed += new System.Timers.ElapsedEventHandler(Execute);
            t.AutoReset = true;
            t.Enabled = true;
            t.Start();*/

        }
        public void Execute(object source, System.Timers.ElapsedEventArgs e)
        {
           
        }

        private void textBox1_TextChanged(object sender, EventArgs e)
        {

        }

        private void button1_Click(object sender, EventArgs e)
        {

        }

        private void label1_Click(object sender, EventArgs e)
        {

        }

        private void splitContainer1_Panel1_Paint(object sender, PaintEventArgs e)
        {

        }

        private void menuStrip1_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
        {

        }

        private void menuStrip1_ItemClicked_1(object sender, ToolStripItemClickedEventArgs e)
        {

        }

        private void button7_Click(object sender, EventArgs e)
        {
            荐购 form = new 荐购();
            this.Hide();
            form.ShowDialog();
        }

        private void button5_Click(object sender, EventArgs e)
        {
           
            
        }

        private void button3_Click(object sender, EventArgs e)
        {
            String id = user.Id;
            if (id == null)
            {
                用户登录 form = new 用户登录();
                MessageBox.Show("未登录，请先登录");
                this.Hide();
                form.TopMost = true;
                form.Show();
            }
            else
            {
                还书 form = new 还书();
                this.Hide();
                form.ShowDialog();
            }
        }
        private void button4_Click(object sender, EventArgs e)
        {


        }

        private void button2_Click(object sender, EventArgs e)
        {
            this.Hide();
            用户登录 form = new 用户登录();
            form.Show();
            
        }
       
        private void button1_Click_1(object sender, EventArgs e)
        {
            //this.Hide();
            //书籍详情 form = new 书籍详情();
           
            //form.Show();
            书籍详情 frm = new 书籍详情();
            frm.ShowDialog();
            if (frm.DialogResult == DialogResult.OK)
            {
                label13.Text = "user.Name";

            }
            
            else if (frm.DialogResult == DialogResult.Cancel)
              {
                String id = user.Id;
                if (id == null)
                {
                    label13.Text = " ";
                }
                else
                {
                    label13.Text = "欢迎您： "+user.Name;
                }

            }
            frm.Close();
        }

        private void button9_Click(object sender, EventArgs e)
        {
            书籍详情 f = new 书籍详情();
            f.Show();
            //this.Close();
        }

        private void button9_Click_1(object sender, EventArgs e)
        {
          
        }

        private void button9_Click_2(object sender, EventArgs e)
        {
            User user = 用户登录.user;
            String id = user.Id;
            if (id == null)
            {
                this.Hide();
                用户登录 form1 = new 用户登录("info");
                MessageBox.Show("当前未登录");
                form1.ShowDialog();
                
            }
            else
            {
                个人中心 form2 = new 个人中心();
                form2.ShowDialog();
                this.Close();
            }

        }
        public String key;
        public String content;
        private void button8_Click(object sender, EventArgs e)
        {
            
            key = comboBox1.SelectedItem.ToString();        
            content = textBox1.Text;     
            查询书籍 form0 = new 查询书籍(key,content);
            form0.Show();
           // this.Hide();
        }



        private void button4_Click_1(object sender, EventArgs e)
        {
            查询书籍 form = new 查询书籍(comboBox1.SelectedItem.ToString(),"");
            form.Show();
        }

        private void button6_Click(object sender, EventArgs e)
        {
            赔书 form = new 赔书();
            form.Show();
            
        }

       
    }
}
